home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Entertainment / MacMud / Unix / netdb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-10  |  2.5 KB  |  77 lines  |  [TEXT/????]

  1. /*
  2.  * Copyright (c) 1980,1983,1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  *
  12.  *    @(#)netdb.h    5.9 (Berkeley) 4/5/88
  13.  */
  14.  
  15. /*
  16.  * Structures returned by network
  17.  * data base library.  All addresses
  18.  * are supplied in host order, and
  19.  * returned in network order (suitable
  20.  * for use in system calls).
  21.  */
  22. struct    hostent {
  23.     char    *h_name;        /* official name of host */
  24.     char    **h_aliases;    /* alias list */
  25.     int        h_addrtype;        /* host address type */
  26.     int        h_length;        /* length of address */
  27.     char    **h_addr_list;    /* list of addresses from name server */
  28. #define    h_addr    h_addr_list[0]    /* address, for backward compatiblity */
  29. };
  30.  
  31. /*
  32.  * Assumption here is that a network number
  33.  * fits in 32 bits -- probably a poor one.
  34.  */
  35. struct    netent {
  36.     char        *n_name;    /* official name of net */
  37.     char        **n_aliases;    /* alias list */
  38.     int        n_addrtype;    /* net address type */
  39.     unsigned long    n_net;        /* network # */
  40. };
  41.  
  42. struct    servent {
  43.     char    *s_name;    /* official service name */
  44.     char    **s_aliases;    /* alias list */
  45.     int    s_port;        /* port # */
  46.     char    *s_proto;    /* protocol to use */
  47. };
  48.  
  49. struct    protoent {
  50.     char    *p_name;    /* official protocol name */
  51.     char    **p_aliases;    /* alias list */
  52.     int    p_proto;    /* protocol # */
  53. };
  54.  
  55. struct rpcent {
  56.     char    *r_name;    /* name of server for this rpc program */
  57.     char    **r_aliases;    /* alias list */
  58.     int    r_number;    /* rpc program number */
  59. };
  60.  
  61. struct hostent    *gethostbyname(), *gethostbyaddr(), *gethostent();
  62. struct netent    *getnetbyname(), *getnetbyaddr(), *getnetent();
  63. struct servent    *getservbyname(), *getservbyport(), *getservent();
  64. struct protoent    *getprotobyname(), *getprotobynumber(), *getprotoent();
  65. struct rpcent    *getrpcbyname(), *getrpcbynumber(), *getrpcent();
  66.  
  67. /*
  68.  * Error return codes from gethostbyname() and gethostbyaddr()
  69.  * (left in extern int h_errno).
  70.  */
  71.  
  72. #define    HOST_NOT_FOUND    1 /* Authoritative Answer Host not found */
  73. #define    TRY_AGAIN    2 /* Non-Authoritive Host not found, or SERVERFAIL */
  74. #define    NO_RECOVERY    3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  75. #define    NO_DATA        4 /* Valid name, no data record of requested type */
  76. #define    NO_ADDRESS    NO_DATA        /* no address, look for MX record */
  77.